<template>
  <van-collapse v-model="activeNames" class="pho-form-collapse" :style="newStyle" v-on="$listeners">
    <van-collapse-item
      v-for="item in list"
      :key="item.value"
      :name="item.value"
      :title="item.label"
    >
      <phone-form-row-container :list.sync="item.children" :font="newStyle.font" v-bind="$attrs" />
    </van-collapse-item>
  </van-collapse>
</template>
 
<script>
import { deepClone, toCamelCase } from "../../../utils/index";
import { comMixin } from "../../../utils/comMixins";
export default {
  mixins: [comMixin],
  name: "phone-form-collapse",
  props: {
    value: {
      type: [String, Number],
      default: "",
    },
    list: {
      type: Array,
      default: () => [],
    },
    type: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      activeNames: [],
      deepClone,
      toCamelCase,
    };
  },
  watch: {
    value: {
      immediate: true,
      deep: true,
      handler(newValue) {
        try {
          this.activeNames = newValue.split(",");
        } catch (error) {
          console.log(error);
        }
      },
    },
  },
};
</script>

<style lang="scss" >
.pho-form-collapse {
  color: #323233;
  font-size: 14px;
  line-height: 24px;
  background-color: #fff;
  padding: 0;
  .van-cell {
    color: inherit;
    font-size: inherit;
    line-height: inherit;
    background-color: transparent;
  }
}
</style>